#ifndef MPHTTPRESPONSEFILECONTENT_H
#define MPHTTPRESPONSEFILECONTENT_H

/*****************************************
 * HttpResponseFileContent 继承于 HttpResponseContent
 *****************************************/

#include <fstream>
#include "mpHttpResponseMessage.h"

namespace MP{
namespace HTTP{
namespace INTERNAL{

class HttpResponseFileContent : public HttpResponseContent
{
public:
    HttpResponseFileContent(const std::string& filePath,
                            std::size_t fileOffset);
    ~HttpResponseFileContent() override;

    virtual bool isHttpResponseFileContent() override;
    virtual void beginReadData() override;
    virtual void onReadDataSome(const char* data, std::size_t length) override;
    virtual void endReadData() override;

private:
    std::string _filePath;
    std::size_t _fileOffset;            //写入文件的起始位置
    std::fstream _file_write;
    bool _isCanWriteFile = false;       //标识是否可写入文件

};

}   //INTERNAL
}   //HTTP
}   //MP

#endif // MPHTTPRESPONSEFILECONTENT_H
